import {BaseUrl} from "../constant/constant";
import {ApiFetch} from "../api/apiHandler";
const log = console.log.bind(console)

// type AddFootballPlayerJson struct {
//     Name            string `binding:"required"` //球员名字
//     Place           string `binding:"required"` //位置
//     Countryteamname string `binding:"required"` //国家队名
//     Clubteamname    string `binding:"required"` //俱乐部队名
//     Number          string `binding:"required"` //球衣号码
// }

// type SetFootballPlayerJson struct {
//     Id              int64  `binding:"min=1"`
//     Name            string `binding:"required"` //球员名字
//     Place           string `binding:"required"` //位置
//     Countryteamname string `binding:"required"` //国家队名
//     Clubteamname    string `binding:"required"` //俱乐部队名
//     Number          string `binding:"required"` //球衣号码
// }

// type GetFootballPlayerJson struct {
//     Flag int `binding:"min=0,max=5"` //0=不限制,1=球员名字,2=位置,3=国家队名,4=俱乐部队名,5=球衣号码
//     Txt  string
//     P    int `binding:"min=-1"` //-1=获取全部
// }

class PlayerModel {
    constructor() {
        this.url = BaseUrl
    }

    add(params) {
        let end = this.url + 'addfootballplayer'
        let req = new ApiFetch(end)
        return req.fetch(params)
    }

    set(params) {
        let end = this.url + 'setfootballplayer'
        let req = new ApiFetch(end)
        return req.fetch(params)
    }

    all(params) {
        let end = this.url + 'getfootballplayer'
        let req = new ApiFetch(end)
        return req.fetch(params)
    }

    delete(params) {
        let end = this.url + 'delfootballplayer'
        let req = new ApiFetch(end)
        return req.fetch(params)
    }
}

export default PlayerModel